#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- mode: python -*-

import zlib, time, imghdr

def zero_padded_timestamp_str (timestamp):
  return '%.7f' % timestamp

def generate_request_id (template_id, id, remote_ip):
  return zlib.adler32(template_id + id + remote_ip + str(time.time())) & 0xffffffff

def get_image_mime (image_data):
  return 'image/%s' % imghdr.what(None, image_data)
